import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class MyOrder extends StatefulWidget {
  @override
  _MyOrderState createState() => _MyOrderState();
}

class _MyOrderState extends State<MyOrder> {
  List<Map<String, String>> orderData = [
    {'image': 'images/user.png', 'title': '待付款'},
    {'image': 'images/user.png', 'title': '待发货'},
    {'image': 'images/user.png', 'title': '待收货'},
    {'image': 'images/user.png', 'title': '待评价'},
    {'image': 'images/user.png', 'title': '售后/退款'},
  ];

  @override
  Widget build(BuildContext context) {
    return Container(
      width: 750.w,
      decoration: BoxDecoration(
        color: Colors.grey[200],
      ),
      child: Container(
        decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(8.w),
        ),
        child: Column(
          children: [
            SizedBox(
              height:20.w,
            ),
          Container(
            width: 720.w,
            height: 120.w,
            decoration: BoxDecoration(
                color: Colors.white,
                border: Border(
                    bottom: BorderSide(
                        color: Color.fromRGBO(244, 233, 244, 1), width: 1))),
            child: ListTile(
              title: Text('我的订单',style: TextStyle(color: Colors.red),),
              trailing: Row(
                mainAxisSize: MainAxisSize.min,
                mainAxisAlignment: MainAxisAlignment.end,
                children: [Text('全部订单'), Icon(Icons.chevron_right)],
              ),
            ),
          ),
            Container(
              height: 150.w,
              width: 720.w,
              margin: EdgeInsets.only( bottom: 20.h),
              decoration: BoxDecoration(
                  color: Colors.white,
                  border: Border.all(color: Colors.grey[200], width: 1)),
              alignment: Alignment.center,
              child: Row(
                  mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                  crossAxisAlignment: CrossAxisAlignment.center,
                  children: orderData.toList().map((value) {
                    return Container(
                      width: 130.w,
                      height: 100.w,
                      child: Column(
                        children: [
                          InkWell(
                            onTap: () {
                              Navigator.of(context).pushNamed('/order');
                            },
                            child: Column(
                              children: [
                                Container(
                                  height: 50.h,
                                  child: Image.asset(
                                    value['image'],
                                    width: 80.w,
                                    height: 80.w,
                                    fit: BoxFit.cover,
                                  ),
                                ),
                                SizedBox(height: 8.h),
                                Text(value['title'],
                                  overflow: TextOverflow.ellipsis,
                                  maxLines: 1,
                                  style: TextStyle(
                                  fontSize: 25.sp
                                ),),
                              ],
                            ),
                          ),
                          VerticalDivider(),
                        ],
                      ),
                    );
                  }).toList()),
            )
          ],
        ),
      )
      ,
    );
  }
}
